#include <bits/stdc++.h>
#define int long long 
using namespace std;

const int maxn = 1e5 + 5;
int arr[maxn];

void solve(){
	int n;
	cin >> n;
	for (int i=1;i<=n;i++) {
		cin >> arr[i];
	}
	sort(arr+1, arr+1+n);
	int mn = 1e9;
	for (int i=1;i<n;i++) {
		mn = min(mn, abs(arr[i+1]-arr[i]));
	}
	cout << mn << '\n';
}


signed main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}
